package com.ykt.controller;

import java.util.List;

import com.jfinal.ext.route.ControllerBind;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;
import com.ykt.model.User;
@ControllerBind(controllerKey="/merchant")
public class MerchantController extends BaseController<User>{
	public MerchantController(){
		super(User.class);
	}
	
	public void grid() {
        int page = getParaToInt("page", 1);
        int rows = this.getParaToInt("rows", 20);
        try {
            Page<User> date = User.dao.pageFindModelForMerchant(page, rows, this.toParaMap());
            rendDataGrid(date);
        } catch (Exception e) {
            log.error(e);
            rendJson(false, e.getMessage());
        }
    }
	
	public void combobox() {
        List<Record> list = null;
        String sql = "SELECT u.id,u.name FROM user u where u.role='MERCHANT'";
        list = Db.find(sql);

        this.renderJson(list);
    }

}
